package xin.marcher.module.rights.support;

/**
 *
 */
public class LoginUserHolder {

    private static final ThreadLocal<LoginUser> USER_DEATILS_HOLDER = new ThreadLocal<>();

    public static LoginUser getLoginUser() {
        LoginUser loginUser = USER_DEATILS_HOLDER.get();
        if (loginUser == null) {
            USER_DEATILS_HOLDER.set(new LoginUser());
        }
        return loginUser;
    }

    public static void setLoginUser(LoginUser loginUser) {
        USER_DEATILS_HOLDER.set(loginUser);
    }

    public static void clearLoginUser() {
        USER_DEATILS_HOLDER.remove();
    }
}
